/*
 * @Descripttion: 服务
 * @version: 1.0.0
 * @Author: shuaishuai.han
 * @Date: 2021-12-21 13:38:18
 */
import store from '../store';

// 获取用户信息 判断当前用户是否已登录
const getUserInfo = async () => {
  return new Promise((resolve, reject) => {
    if (JSON.stringify(store.state.userInfo) === '{}') {
      reject('暂未登录');
    } else {
      resolve();
    }
  });
};

export const patchGlobalConfig = async () => {
  try {
    await getUserInfo();
    return { status: 200 };
  } catch (e) {
    return { status: 401 };
  }
};
